package com.tengfei.api.index;

import com.tengfei.common.annotation.Anonymous;
import com.tengfei.common.core.domain.R;
import com.tengfei.main.index.service.IIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author feige
 * @version v1.0
 * @date 2022-08-16-10:28
 * @description 管理端首页api
 */

@Api(value = "管理端首页控制器", tags = {"控制端首页管理"})
@RestController
@RequestMapping("/index/index")
public class IndexController {

    @Resource
    private IIndexService indexService;

    /**
     * tab选项卡数据
     *
     * @return
     */
    @Anonymous
    @ApiOperation("选项卡数据项")
    @GetMapping("/tabsData")
    public R<Map<String, Integer>> tabsData() {
        return R.ok(indexService.tabData());
    }

    /**
     * 首页轮播图数据
     *
     * @return
     */
    @Anonymous
    @ApiOperation("轮播图数据项")
    @GetMapping("/chartsData")
    public R<Map<String, Object>> chartsData() {
        return R.ok(indexService.chartsData());
    }
}
